﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLyTruongMamNon.Man_Hinh
{
    public partial class frmMon_Hoc : Form
    {
        public frmMon_Hoc()
        {
            InitializeComponent();
        }
        public void HienThiMon()
        {
            string sql = "select distinct  mh.*, tenkhoi from MON_HOC mh inner join KHOI k on mh.Makhoi=k.makhoi";
            DataTable dt = new DataTable();
            dt=Thu_Vien.ExecuteQuery(sql);

            dtgMon.DataSource=dt;
            dtgMon.DataMember.Contains("Mamon");
            
            cboKhoi.DataSource = dt;
            cboKhoi.DisplayMember = "tenkhoi";
           //cboKhoi.SelectedValue = "Makhoi";
            cboKhoi.DataBindings.Add("text", dt, "Makhoi");

            txtMaMon.DataBindings.Add("text",dt,"Mamon");
            txtTenMon.DataBindings.Add("text",dt, "Tenmon");



        }

        private void frmMon_Hoc_Load(object sender, EventArgs e)
        {
            HienThiMon();
        }


    }
}

